﻿<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<head>
<title>平台优惠劵列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath()%>/style/adminStyle.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script src="<%=request.getContextPath()%>/js/public.js"></script>
<script type="text/javascript">
function selec() {
	var sr=${admin.jurisdiction};
	 if(sr==1){
		 alert("权限不足");
		return false;
	 }else{
		 return true;
	 }
}


</script>
	

</head>
<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i></i><em>平台优惠劵列表</em></span>
    <span class="modular fr"><a href="<%=request.getContextPath()%>/Administrators/coupon_in.do" class="pt-link-btn" onclick="return selec()">+新增优惠劵</a></span>
  </div>
  
  
  <table class="list-style Interlaced">
  
   <c:if test="${couponlist[0].usingplatform==null}">
   <span style="text-align: center;display:block;color:#A4A4A4; font-size: 3em;margin-top: 15%;">哎呀，暂无平台优惠活动!</span>
    </c:if>
   <c:if test="${couponlist[0].usingplatform!=null}">
    <tr>
    <th>id</th>
    <th>发放平台名称</th>
    <th>发放总量</th>
    <th>未用</th>
    <th>已用</th>
    <th>操作</th>
   </tr>
   <c:forEach items="${couponlist}" var="op" varStatus="status">
   <tr>
   	<td align="center" valign="middle">${status.index+1}</td>
   	<td align="center">${op.usingplatform}</td>
   	<td align="center">${op.count}</td>
   	<td align="center">${op.usecount}</td>
    <td align="center">${op.nocount}</td>
    <td class="center">
     <a href="../Administrators/coupon_detailed.do?usingplatform=${op.usingplatform}" title="查看" onclick="return selec()"><img src="<%=request.getContextPath()%>/images/icon_view.gif" /></a>
      <a title="删除"  onclick="return del(&quot+${op.usingplatform}+&quot);"><img src="<%=request.getContextPath()%>/images/icon_drop.gif"/></a>
    </td>
   </tr>
   </c:forEach>
   </c:if>
  </table>
 
 </div>
<script type="text/javascript">
function del(usingplatform) {	
	var using=usingplatform.replace("+","").replace("+","");
	var msg = "您确定要删除"+using+"所有未绑定的优惠券吗？\n\n请确认！";
	var sr=${admin.jurisdiction};
	if (confirm(msg)==true){
		if(sr==1){
			  alert("权限不足");
			  return false;
		}else{			
			$.ajax({
				"url":"${pageContext.request.contextPath}/Administrators/platform_delete.do",
				"data":"usingplatform="+using,
				"type":"POST",
				"dataType":"json",
				"success":function(obj){
					if(obj.state==1){
						alert("删除成功");
						window.location="${pageContext.request.contextPath}/Administrators/coupon_list.do";	
					}else{
						alert("删除失败");						
					}			
				}});
		}
	}
	}


</script>
</body>
</html>